#include "behemoth.h"
#include "../random.h"
#include "../Spells/healingspell.h"
#include "../Spells/damagespell.h"

Texture* Behemoth::behemoth_texture = nullptr;

Behemoth::Behemoth(): Enemy("Behemoth", 250, 100, 2, behemoth_texture) {
    if (behemoth_texture == nullptr) {
        behemoth_texture = new Texture("behemoth.png");
        this->texture = behemoth_texture;
    }
    Spells.push_back(new DamageSpell("Meteor", 100, 100));
    Spells.push_back(new HealingSpell("Recover", 250, 25));
}


void Behemoth::turn(Unit* u) {
    if (HP.Current < 55) {
        int val = Random::NextInt(2);
        if (val && MP.Current >= Spells[0]->mp_cost)
            Spells[0]->cast(this, u);
        else if (!val && MP.Current >= Spells[1]->mp_cost)
            Spells[1]->cast(this, u);
        else
            u->HP.Current -= 50;
    }
    else {
        u->HP.Current -= 50;
    }
}
